package org.jackysoft.controller;

import java.util.Collection;

import javax.annotation.Resource;

import org.jackysoft.controller.base.AbstractController;
import org.jackysoft.entity.OsVariableContext;
import org.jackysoft.service.OsVariableContextService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/oswf/vars")
public class OsVariableContextController extends
AbstractController<OsVariableContext> {
	
	@Resource
	private OsVariableContextService service;
	

	
	@RequestMapping("/byworkflow")
	public String byworkflow(String refname,
			@ModelAttribute Collection<OsVariableContext> beans) throws Exception {
		beans = service.findAllByRefname(refname);
		return "byworkflow";

	}

	@ResponseBody
	@RequestMapping("/findbyname")
	public OsVariableContext get(String refname,String name) throws Exception {
		OsVariableContext bean = service.findByName(refname, name);				
				
		return bean;
	}


}